layui.use(['form'],function () {
    var form = layui.form
        , $ = layui.jquery
        , field = JSON.parse(localStorage.getItem('qiniuyun'));

    form.val("form",field)
    $("#rename").val(field.rename)
    form.render()

    $("input").bind('input propertychange', function() {
        field[$(this).attr('name')] = $(this).val()
        localStorage.setItem('qiniuyun',JSON.stringify(field))
    })
    form.on('select(select)', function(data){
        field[$(data.elem).attr('name')] = data.value
        localStorage.setItem('qiniuyun',JSON.stringify(field))
    });

    form.on('submit(*)', function(data){
        localStorage.setItem('qiniuyun',JSON.stringify(data.field))
        window.location.href = "popup.html"
        return false;
    });
})
